/*
 * Copyright (C) 2018 xuexiangjys(xuexiangjys@163.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 1027
 * 24577
 */

package com.xuexiang.xdlinkdemo.util;

import android.content.Context;

import com.xuexiang.xutil.XUtil;
import com.xuexiang.xutil.data.BaseSPUtil;

/**
 * @author xuexiang
 * @since 2018/9/5 下午11:21
 */
public class SettingSpUtils extends BaseSPUtil {

    private static volatile SettingSpUtils sInstance;

    private SettingSpUtils(Context context) {
        super(context);
    }

    public static SettingSpUtils get() {
        if (sInstance == null) {
            synchronized (SettingSpUtils.class) {
                if (sInstance == null) {
                    sInstance = new SettingSpUtils(XUtil.getContext());
                }
            }
        }
        return sInstance;
    }

    /**
     * 获取服务器地址
     *
     * @return
     */
    public String getServerIP() {
        return getString("ServerIP", "192.168.0.1");
    }

    /**
     * 设置服务器地址
     *
     * @return
     */
    public boolean setServerIP(String ip) {
        return putString("ServerIP", ip);
    }


    /**
     * 获取VID
     *
     * @return
     */
    public String getVID() {
        return getString("VID", "-1");
    }

    /**
     * 设置VID
     *
     * @return
     */
    public boolean setVID(String vid) {
        return putString("VID", vid);
    }

    /**
     * 获取PID
     *
     * @return
     */
    public String getPID() {
        return getString("PID", "-1");
    }

    /**
     * 设置PID
     *
     * @return
     */
    public boolean setPID(String pid) {
        return putString("PID", pid);
    }


}
